package com.ht.pms.core.controller;

import com.ht.pms.core.common.exception.ServiceException;
import com.ht.pms.core.dto.Result;
import com.ht.pms.core.service.SalaryBusinessDictService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
//@RequestMapping(value = "/xindai")
public class SalaryBusinessDictController {

    private static final Logger LOG = LoggerFactory.getLogger(SalaryBusinessDictController.class);

    @Autowired
    private SalaryBusinessDictService salaryBusinessDictService;

    @PostMapping(value = "/addColumn")
    @ResponseBody
    @ApiOperation("添加字段接口")
    public Result addColumn() throws Exception {
        LOG.info("=================>>>>添加字段接口开始");
        Result result = null;
        try {


            salaryBusinessDictService.addColumn();
            result = Result.buildSuccess();
        } catch (ServiceException se) {
            result = Result.buildFail(se.getCodeDesc(), se.getErrorMsg());
        } catch (Exception e) {
            LOG.error("=============>>>>添加字段出错", e);
            result = Result.buildFail();
        }
        LOG.info("=================>>>>添加字段结束{}", result);
        return result;
    }
}
